package com.qyer.search.model.aggregation;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import java.util.Map;

/**
 * Created by tangzheng on 16/7/17.
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Aggregation {

  @JsonProperty
  private Map<Integer, STGInfo> stg_info;
  @JsonProperty
  private List<Integer> stg_order;
  @JsonProperty
  private Intention intention;

  public Aggregation(Map<Integer, STGInfo> stg_info, List<Integer> stg_order, Intention intention) {
    this.stg_info = stg_info;
    this.stg_order = stg_order;
    this.intention = intention;
  }

  public Map<Integer, STGInfo> getStg_info() {
    return stg_info;
  }

  public void setStg_info(Map<Integer, STGInfo> stg_info) {
    this.stg_info = stg_info;
  }

  public List<Integer> getStg_order() {
    return stg_order;
  }

  public void setStg_order(List<Integer> stg_order) {
    this.stg_order = stg_order;
  }

  public Intention getIntention() {
    return intention;
  }

  public void setIntention(Intention intention) {
    this.intention = intention;
  }

  @Override public boolean equals(Object o) {
    if (this == o)
      return true;
    if (o == null || getClass() != o.getClass())
      return false;

    Aggregation that = (Aggregation) o;

    if (!stg_info.equals(that.stg_info))
      return false;
    if (!stg_order.equals(that.stg_order))
      return false;
    return intention.equals(that.intention);

  }

  @Override public int hashCode() {
    int result = stg_info.hashCode();
    result = 31 * result + stg_order.hashCode();
    result = 31 * result + intention.hashCode();
    return result;
  }
}
